package com.yoosora.common.mode.response;

/**
 * @author yoosora
 */
public class SingleResponse<T> extends AbstractResponse {
	private static final long serialVersionUID = 6225136896611711580L;
	private T obj;

	public SingleResponse() {
	}

	public T getObj() {
		return this.obj;
	}

	public static <T> Builder<T> newBuilder() {
		return new Builder();
	}

	public static class Builder<T> extends AbstractResponse.Builder<Builder<T>> {
		private T obj;

		private Builder() {
		}

		public Builder<T> succ(T obj) {
			this.errcode = 0;
			this.obj = obj;
			return this;
		}

		public SingleResponse<T> build() {
			SingleResponse<T> resp = new SingleResponse();
			resp.errcode = this.errcode;
			resp.errmsg = this.errmsg;
			resp.obj = this.obj;
			return resp;
		}
	}
}
